Giter VIP home page Giter VIP logo

monodroid-schema-gen's Introduction

= What is this? =

monodroid-schema-gen is an Android layout.xml schema generator.

WARNING: Android layout xml does not fit well with XML schema restrictions.
XML Schema is not extensible enough to accept non-standard components nor
non-standard attributes which are (still) in android XML namespace (due to
the limitation of element/attribute wildcards). So, you CANNOT use the
resulting schema to VALIDATE your layout xml resources.
It should be used only for auto-complete element/attribute candidates.

It consists of three separate tools.

- type-hierarchy-importer.exe fetches android documentation for
  android.view.View (i.e. View.html), parses the documents for all known
  indirect subclasses of View as well as View itself, and outputs java-based
  type hierarchy definitions.
  It generates type-hierarchy.xml.

- gen-android-r-styleable.exe fetches android documentation for
  android.R.styleable, which is in fact deprecated and does not exist in
  android.jar (thus nor Mono.Android.dll), parses the document for all known
  attributes in android namespace, and outputs the attributes list.
  It generates all-known-attributes.xml.

- monodroid-schema-gen.exe parses Mono.Android.dll and all-known-attributes.xml
  to generate schemas which reside in each namespace.


= Usage =

run below:

	make MONO_ANDROID_DLL=/path/to/Mono.Android.dll

which should take all care.
This takes for a while, as attribute-doc-importer.exe retrieves ALL relevant
HTML documentation webpages from developer.android.com.

It will generate two schema files:

	- android-layout-xml.xsd
	- schemas.android.com.apk.res.android.xsd

That's all. Note that both are required to auto-complete layout.xml nodes.

= External Tool =

It uses SgmlReader: http://code.msdn.microsoft.com/SgmlReader.

Atsushi Eno

monodroid-schema-gen's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

monodroid-schema-gen's Issues

Crash

First of all, cool tool. I'm not sure if it solves the problem that i'm working on but it's at least a step in the right direction. (trying to get a close enough xsd for autocomplete in netbeans and other java IDEs (other than android studio).

Just cloned and ran make (on osx) and got the following output
make
dmcs -debug monodroid-schema-gen.cs
dmcs -debug type-hierarchy-importer.cs extlibs/SgmlReader/sgmlreaderdll/.cs
type-hierarchy-importer.cs(55,7): warning CS0219: The variable wc' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1500,17): warning CS0219: The variablestart' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1535,17): warning CS0219: The variable start' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1564,18): warning CS0219: The variablech' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(829,19): warning CS0219: The variable start' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(866,30): warning CS0219: The variablen' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(1015,13): warning CS0162: Unreachable code detected
type-hierarchy-importer.cs(17,15): warning CS0414: The private field Driver.atts' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(271,16): warning CS0414: The private fieldSgml.SgmlReader.rootElementName' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(285,16): warning CS0649: Field Sgml.SgmlReader.startTag' is never assigned to, and will always have its default valuenull'
Compilation succeeded - 10 warning(s)
mono --debug type-hierarchy-importer.exe
Processing http://developer.android.com/reference/android/view/View.html...
Processing http://developer.android.com/reference/android/widget/AnalogClock.html...
Processing http://developer.android.com/reference/android/widget/ImageView.html...
Processing http://developer.android.com/reference/android/inputmethodservice/KeyboardView.html...
Processing http://developer.android.com/reference/android/support/v7/app/MediaRouteButton.html...
Processing http://developer.android.com/reference/android/widget/ProgressBar.html...
Processing http://developer.android.com/reference/android/support/v4/widget/Space.html...
Processing http://developer.android.com/reference/android/view/SurfaceView.html...
Processing http://developer.android.com/reference/android/widget/TextView.html...
Processing http://developer.android.com/reference/android/view/TextureView.html...
Processing http://developer.android.com/reference/android/view/ViewGroup.html...
Processing http://developer.android.com/reference/android/view/ViewStub.html...
Processing http://developer.android.com/reference/android/widget/AbsListView.html...
Processing http://developer.android.com/reference/android/widget/AbsSeekBar.html...
Processing http://developer.android.com/reference/android/widget/AbsSpinner.html...
Processing http://developer.android.com/reference/android/widget/AbsoluteLayout.html...
Processing http://developer.android.com/reference/android/support/v7/widget/ActionMenuView.html...
Processing http://developer.android.com/reference/android/widget/AdapterView.html...
Processing http://developer.android.com/reference/android/widget/AdapterViewAnimator.html...
Processing http://developer.android.com/reference/android/widget/AdapterViewFlipper.html...
Processing http://developer.android.com/reference/android/support/design/widget/AppBarLayout.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatAutoCompleteTextView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatButton.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatCheckBox.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatCheckedTextView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatEditText.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatRadioButton.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatRatingBar.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatSpinner.html...
Processing http://developer.android.com/reference/android/support/v7/widget/AppCompatTextView.html...
Processing http://developer.android.com/reference/android/appwidget/AppWidgetHostView.html...
Processing http://developer.android.com/reference/android/widget/AutoCompleteTextView.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/BaseCardView.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/BrowseFrameLayout.html...
Processing http://developer.android.com/reference/android/widget/Button.html...
Processing http://developer.android.com/reference/android/widget/CalendarView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/CardView.html...
Processing http://developer.android.com/reference/android/widget/CheckBox.html...
Processing http://developer.android.com/reference/android/widget/CheckedTextView.html...
Processing http://developer.android.com/reference/android/widget/Chronometer.html...
Processing http://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout.html...
Processing http://developer.android.com/reference/android/widget/CompoundButton.html...
Processing http://developer.android.com/reference/android/support/v4/widget/ContentLoadingProgressBar.html...
Processing http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html...
Processing http://developer.android.com/reference/android/widget/DatePicker.html...
Processing http://developer.android.com/reference/android/widget/DialerFilter.html...
Processing http://developer.android.com/reference/android/widget/DigitalClock.html...
Processing http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html...
Processing http://developer.android.com/reference/android/widget/EditText.html...
Processing http://developer.android.com/reference/android/widget/ExpandableListView.html...
Processing http://developer.android.com/reference/android/inputmethodservice/ExtractEditText.html...
Processing http://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html...
Processing http://developer.android.com/reference/android/app/FragmentBreadCrumbs.html...
Processing http://developer.android.com/reference/android/support/v13/app/FragmentTabHost.html...
Processing http://developer.android.com/reference/android/widget/FrameLayout.html...
Processing http://developer.android.com/reference/android/opengl/GLSurfaceView.html...
Processing http://developer.android.com/reference/android/widget/Gallery.html...
Processing http://developer.android.com/reference/android/gesture/GestureOverlayView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/GridLayout.html...
Processing http://developer.android.com/reference/android/widget/GridView.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/HorizontalGridView.html...
Processing http://developer.android.com/reference/android/widget/HorizontalScrollView.html...
Processing http://developer.android.com/reference/android/widget/ImageButton.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/ImageCardView.html...
Processing http://developer.android.com/reference/android/widget/ImageSwitcher.html...
Processing http://developer.android.com/reference/android/widget/LinearLayout.html...
Processing http://developer.android.com/reference/android/support/v7/widget/LinearLayoutCompat.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/ListRowHoverCardView.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/ListRowView.html...
Processing http://developer.android.com/reference/android/widget/ListView.html...
Processing http://developer.android.com/reference/android/widget/MediaController.html...
Processing http://developer.android.com/reference/android/widget/MultiAutoCompleteTextView.html...
Processing http://developer.android.com/reference/android/support/design/widget/NavigationView.html...
Processing http://developer.android.com/reference/android/support/v4/widget/NestedScrollView.html...
Processing http://developer.android.com/reference/android/widget/NumberPicker.html...
Processing http://developer.android.com/reference/android/support/v4/view/PagerTabStrip.html...
Processing http://developer.android.com/reference/android/support/v4/view/PagerTitleStrip.html...
Processing http://developer.android.com/reference/android/widget/QuickContactBadge.html...
Processing http://developer.android.com/reference/android/widget/RadioButton.html...
Processing http://developer.android.com/reference/android/widget/RadioGroup.html...
Processing http://developer.android.com/reference/android/widget/RatingBar.html...
Processing http://developer.android.com/reference/android/support/v7/widget/RecyclerView.html...
Processing http://developer.android.com/reference/android/widget/RelativeLayout.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/RowHeaderView.html...
Processing http://developer.android.com/reference/android/widget/ScrollView.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/SearchBar.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/SearchEditText.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/SearchOrbView.html...
Processing http://developer.android.com/reference/android/support/v7/widget/SearchView.html...
Processing http://developer.android.com/reference/android/widget/SeekBar.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/ShadowOverlayContainer.html...
Processing http://developer.android.com/reference/android/widget/SlidingDrawer.html...
Processing http://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.html...
Processing http://developer.android.com/reference/android/support/v7/widget/Space.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/SpeechOrbView.html...
Processing http://developer.android.com/reference/android/widget/Spinner.html...
Processing http://developer.android.com/reference/android/widget/StackView.html...
Processing http://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html...
Processing http://developer.android.com/reference/android/widget/Switch.html...
Processing http://developer.android.com/reference/android/support/v7/widget/SwitchCompat.html...
Processing http://developer.android.com/reference/android/widget/TabHost.html...
Processing http://developer.android.com/reference/android/support/design/widget/TabLayout.html...
Processing http://developer.android.com/reference/android/widget/TabWidget.html...
Processing http://developer.android.com/reference/android/widget/TableLayout.html...
Processing http://developer.android.com/reference/android/widget/TableRow.html...
Processing http://developer.android.com/reference/android/widget/TextClock.html...
Processing http://developer.android.com/reference/android/support/design/widget/TextInputLayout.html...
Processing http://developer.android.com/reference/android/widget/TextSwitcher.html...
Processing http://developer.android.com/reference/android/widget/TimePicker.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/TitleView.html...
Processing http://developer.android.com/reference/android/widget/ToggleButton.html...
Processing http://developer.android.com/reference/android/support/v7/widget/Toolbar.html...
Processing http://developer.android.com/reference/android/media/tv/TvView.html...
Processing http://developer.android.com/reference/android/widget/TwoLineListItem.html...
Processing http://developer.android.com/reference/android/support/v17/leanback/widget/VerticalGridView.html...
Processing http://developer.android.com/reference/android/widget/VideoView.html...
Processing http://developer.android.com/reference/android/widget/ViewAnimator.html...
Processing http://developer.android.com/reference/android/widget/ViewFlipper.html...
Processing http://developer.android.com/reference/android/support/v4/view/ViewPager.html...
Processing http://developer.android.com/reference/android/widget/ViewSwitcher.html...
Processing http://developer.android.com/reference/android/webkit/WebView.html...
Processing http://developer.android.com/reference/android/widget/ZoomButton.html...
Processing http://developer.android.com/reference/android/widget/ZoomControls.html...
dmcs -debug get-android-r-styleable.cs extlibs/SgmlReader/sgmlreaderdll/
.cs
extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1500,17): warning CS0219: The variable start' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1535,17): warning CS0219: The variablestart' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlParser.cs(1564,18): warning CS0219: The variable ch' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(829,19): warning CS0219: The variablestart' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(866,30): warning CS0219: The variable n' is assigned but its value is never used extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(1015,13): warning CS0162: Unreachable code detected extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(271,16): warning CS0414: The private fieldSgml.SgmlReader.rootElementName' is assigned but its value is never used
extlibs/SgmlReader/sgmlreaderdll/SgmlReader.cs(285,16): warning CS0649: Field Sgml.SgmlReader.startTag' is never assigned to, and will always have its default valuenull'
Compilation succeeded - 8 warning(s)
dmcs -debug convert-csv.cs
mono --debug convert-csv.exe > layout_schema_enumerations.xml
mono --debug get-android-r-styleable.exe
mono --debug ./monodroid-schema-gen.exe ""
Merging AbsoluteLayout_Layout into View
Merging ActionBar_LayoutParams into View

Unhandled Exception:
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/throwhelper.cs:74
at System.Collections.Generic.Dictionary2[System.String,System.String].Insert (System.String key, System.String value, Boolean add) [0x00000] in <filename unknown>:0 at System.Collections.Generic.Dictionary2[System.String,System.String].Add (System.String key, System.String value) [0x00000] in :0
at Commons.AndroidSchemaGen.Driver.LoadXml () [0x001cf] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:193
at Commons.AndroidSchemaGen.Driver.Run (System.String[] args) [0x00002] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:31
at Commons.AndroidSchemaGen.Driver.Main (System.String[] args) [0x00007] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:17
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/throwhelper.cs:74
at System.Collections.Generic.Dictionary2[System.String,System.String].Insert (System.String key, System.String value, Boolean add) [0x00000] in <filename unknown>:0 at System.Collections.Generic.Dictionary2[System.String,System.String].Add (System.String key, System.String value) [0x00000] in :0
at Commons.AndroidSchemaGen.Driver.LoadXml () [0x001cf] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:193
at Commons.AndroidSchemaGen.Driver.Run (System.String[] args) [0x00002] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:31
at Commons.AndroidSchemaGen.Driver.Main (System.String[] args) [0x00007] in /Users/alex/projects/monodroid-schema-gen/monodroid-schema-gen.cs:17
make: *** [android-layout-xml.xsd] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.