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

rtx.getType() return wrong thing. #32

Closed
bark opened this issue Jun 4, 2014 · 3 comments
Closed

rtx.getType() return wrong thing. #32

bark opened this issue Jun 4, 2014 · 3 comments

Comments

@bark
Copy link
Contributor

bark commented Jun 4, 2014

Code:
rtx.moveTo(diffTuple.getNewNodeKey());
System.out.println("Is element: " +rtx.isElement());
System.out.println("Is attr: " +rtx.isAttribute());
System.out.println("Is text: " +rtx.isText());
System.out.println("type: "+rtx.getType());

Output:
Element in:
Is element: true
Is attr: false
Is text: false
type: xs:untyped

Expected:
type: xs:element

Attribute in:
Is element: false
Is attr: true
Is text: false
type: xs:untyped
type: xs:attribute

Text in:
Is element: false
Is attr: false
Is text: true
[error] play - Cannot invoke the action, eventually got an error: java.lang.IllegalStateException: No other node types supported!
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.2]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.2]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.2]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.2]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.2]
Caused by: java.lang.IllegalStateException: No other node types supported!
at org.sirix.page.NamePage.getName(NamePage.java:159) ~[sirix-core-0.1.2-SNAPSHOT.jar:na]
at org.sirix.access.PageReadTrxImpl.getName(PageReadTrxImpl.java:484) ~[sirix-core-0.1.2-SNAPSHOT.jar:na]
at org.sirix.access.NodeReadTrxImpl.getType(NodeReadTrxImpl.java:375) ~[sirix-core-0.1.2-SNAPSHOT.jar:na]
at models.SirixHandler.getDiffs(SirixHandler.java:613) ~[na:na]
at models.SirixHandler.generateDiffs(SirixHandler.java:572) ~[na:na]
at models.SirixHandler.getDiff(SirixHandler.java:751) ~[na:na]

Expekted xs:text or xs:string

@JohannesLichtenberger
Copy link
Member

Yeah, currently everything should be xs:untyped as currently the type is not stored. For nodes despite characters / text it's very simple and for text it might or might not be xs:string. This could be statically returned but I'm not sure if it helps. For instance simply always return xs:string for text nodes and xs:element for element nodes. However, you might want the characters as xs:integer if only numbers are represented in the specific node.

@JohannesLichtenberger
Copy link
Member

Probably getKind() helps as it returns an enum type. And probably getType() should throw an UnsupportedOperationException until the type is really stored.

@bark
Copy link
Contributor Author

bark commented Jun 5, 2014

Thanks i had missed getKind() it workes great.

@bark bark closed this as completed Jun 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants