Skip to content
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

Improve/clarify documentation concerning mxmlGetText vs. mxmlGetOpaque #190

Closed
lirunlong opened this issue Mar 30, 2017 · 4 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lirunlong
Copy link

lirunlong commented Mar 30, 2017

eg. <status>abc def</status>

mxml_node_t * status = mxmlFindElement(...);
const char * text = mxmlGetText(status, 0);

I am looking forward to get a string  "abc  def"  , but returned only "abc" , 
Is there another way to get "abc def"?
@michaelrsweet
Copy link
Owner

I need to make this more visible somehow, it is by far the most frequently asked question when using Mini-XML...

The MXML_TEXT type provides whitespace-delimited text values, so in your example there will be two child (text value) nodes: "abc" and "def".

If you want to get opaque text strings then you want to use the MXML_OPAQUE type for children of your element. When loading the XML you can use the MXML_OPAQUE_CALLBACK callback or your own that returns MXML_OPAQUE for this particular element. Then you'll use mxmlGetOpaque(status) to get the string, including all whitespace, etc.

@michaelrsweet michaelrsweet added the question General usage question label Mar 30, 2017
@aespinoza
Copy link

aespinoza commented Nov 10, 2017

@michaelrsweet There is definitely a need to add more information on this somewhere in the main documentation. I stumbled upon this problem too and it took me a while to figure it out.

The solution in here actually helped me a lot. Thank you.

@michaelrsweet michaelrsweet added bug Something isn't working and removed question General usage question labels Nov 12, 2017
@michaelrsweet michaelrsweet self-assigned this Nov 12, 2017
@michaelrsweet michaelrsweet added this to the Stable milestone Nov 12, 2017
@michaelrsweet
Copy link
Owner

OK, reopening to track documentation changes in the next update of Mini-XML...

@michaelrsweet michaelrsweet reopened this Nov 12, 2017
@michaelrsweet michaelrsweet changed the title mxmlGetText Improve/clarify documentation concerning mxmlGetText vs. mxmlGetOpaque Nov 12, 2017
@michaelrsweet
Copy link
Owner

OK, aside from additions to the function references, I've updated the intro text to talk about using opaque strings by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants