-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support to read the vocabulary after a file has been parsed #51
Comments
@glassfishrobot Commented |
@glassfishrobot Commented public org.jvnet.fastinfoset.Vocabulary getInitialVocabulary() { //copy over the restricted alphabets for (counter = 0; counter < size; counter++) { com.sun.xml.fastinfoset.util.CharArray tempArray = _v.restrictedAlphabet.get(counter); tempVocab.restrictedAlphabets.add(tempArray.toString()); } //copy over the encoding-algorithms { tempVocab.restrictedAlphabets.add(_v.encodingAlgorithm.get(counter)); } size = _v.prefix.getSize(); { tempVocab.prefixes.add(_v.prefix.get(counter)); } //copy over the namespace-names { tempVocab.namespaceNames.add(_v.namespaceName.get(counter)); } //copy over the local-names { tempVocab.localNames.add(_v.localName.get(counter)); } //copy over the other-ncnames { tempVocab.otherNCNames.add(_v.otherNCName.get(counter)); } //copy over the other-uris { tempVocab.otherURIs.add(_v.otherURI.get(counter)); } //copy over the attribute-values { tempVocab.attributeValues.add(_v.attributeValue.get(counter)); } //copy over the content-character-chunks { tempVocab.characterContentChunks.add(_v.characterContentChunk.getString(counter)); } //copy over the other-strings { com.sun.xml.fastinfoset.util.CharArray tempArray = _v.otherString.get(counter); tempVocab.otherStrings.add(tempArray.toString()); } //copy over the element-name-surrogates { tempVocab.elements.add(qNameArray[counter].getQName()); } //copy over the attribute-name-surrogates { tempVocab.attributes.add(qNameArray[counter].getQName()); } return tempVocab; |
@glassfishrobot Commented |
|
It would be really helpful to be able to read the vocabulary of a parsed file, as a Fast Infoset file could be exchanged to share an external vocabulary. Unfortunately, there isn't an API to read the vocabulary. Additionally, the vocabulary object returned needs to be an instance of org.jvnet.fastinfoset.Vocabulary so that the returned vocabulary can be later used to initialize an ExternalVocabulary object.
There are probably a few different techniques that could be taken here. For example, we could just subclass SAXDocumentParser and add a new method that analyses the _v ParserVocabulary member variable and returns an instance of org.jvnet.fastinfoset.Vocabulary. Another approach was to just add a getVocabulary method to the Decoder class, which ensures that all classes that inherit off of Decoder have the getVocabulary() method. That's the approach we took. I'll post a patch shortly.
Also, sorry for copy & pasting code inline, as attachments aren't allowed. If you'd prefer me to send something directly, or post a dropbox link, just let me know.
The text was updated successfully, but these errors were encountered: