Tag

Contains a tag's name, values and attributes. It does not contain any information about its child tags because that part of the sdl would not have been parsed yet, however, it does indicate if the tag was followed by an open brace. This struct is used directly for the StAX/SAX APIs and indirectly for the DOM or Reflection APIs.

Constructors

this
this(const(char)[] name, const(char)[][] values)
Undocumented in source.

Members

Aliases

useDefaultSdl
alias useDefaultSdl = useStrictSdl

For now an alias for useStrictSdl. Use this function if you want your code to always use the default mode whatever it may become.

Functions

enforceNoAttributes
void enforceNoAttributes()
Undocumented in source. Be warned that the author may not have intended to support it.
enforceNoChildren
void enforceNoChildren()
Undocumented in source. Be warned that the author may not have intended to support it.
enforceNoValues
void enforceNoValues()
Undocumented in source. Be warned that the author may not have intended to support it.
getOneValue
void getOneValue(T value)
Undocumented in source. Be warned that the author may not have intended to support it.
getValues
void getValues(T[] t, size_t minCount)
Undocumented in source. Be warned that the author may not have intended to support it.
isAnonymous
bool isAnonymous()

Returns true if the tag is anonymous.

opEquals
bool opEquals(Tag other)
resetForNewSdl
void resetForNewSdl()

Gets the tag ready to parse a new sdl tree by resetting the depth and the line number. It is unnecessary to call this before parsing the first sdl tree but would not be harmful. It does not reset the namespace/name/values/attributes because those will be reset by the parser on the next call to parseSdlTag when it calls resetForNextTag().

resetForNextTag
void resetForNextTag()

Resets the tag state to get ready to parse the next tag. Should only be called by the parseSdlTag function. This will clear the namespace/name/values/attributes and increment the depth if the current tag had an open brace.

setIsAnonymous
void setIsAnonymous()

Sets the tag as anonymous

throwIsDuplicate
void throwIsDuplicate()
Undocumented in source. Be warned that the author may not have intended to support it.
throwIsUnknown
void throwIsUnknown()
Undocumented in source. Be warned that the author may not have intended to support it.
toSdl
void toSdl(S sink)

Writes the tag as standard SDL to sink. It will write the open brace '{' but since the tag does not have a knowledge about it's children, its up to the caller to write the close brace '}' after it writes the children to the sink.

toString
string toString()
useLooseSdl
void useLooseSdl()
  1. Causes parseSdlTag to throw SdlParseException if a tag's open brace appears after a newline
  2. Causes parseSdlTag to throw SdlParseException if any tag value appears after any tag attribute
  3. Causes parseSdlTag to set anonymous tag names to "content"
useProposedSdl
void useProposedSdl()
  1. Causes parseSdlTag to allow a tag's open brace appears after any number of newlines
  2. Causes parseSdlTag to allow tag values an attributes to mixed in any order
  3. Causes parseSdlTag to set anonymous tag names to null
useStrictSdl
void useStrictSdl()

This is the default mode.

  1. Causes parseSdlTag to throw SdlParseException if a tag's open brace appears after a newline
  2. Causes parseSdlTag to throw SdlParseException if any tag value appears after any tag attribute
  3. Causes parseSdlTag to set anonymous tag names to "content"

Properties

acceptUnquotedStrings
bool acceptUnquotedStrings [@property getter]

Causes parseSdlTag to accept non-quoted strings

acceptUnquotedStrings
bool acceptUnquotedStrings [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
allowBraceAfterNewline
bool allowBraceAfterNewline [@property getter]

Causes parseSdlTag to allow a tag's open brace to appear after any number of newlines

allowBraceAfterNewline
bool allowBraceAfterNewline [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
allowChildTagsOnSameLineAsBrace
bool allowChildTagsOnSameLineAsBrace [@property getter]

Causes parseSdlTag to allow a child tags to appear on the same line as the parents open and close braces

allowChildTagsOnSameLineAsBrace
bool allowChildTagsOnSameLineAsBrace [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
allowMixedValuesAndAttributes
bool allowMixedValuesAndAttributes [@property getter]

Normally SDL only allows a tag's attributes to appear after all it's values. This flag causes parseSdlTag to allow values/attributes to appear in any order, i.e. tag attr="my-value" "another-value" # would be valid

allowMixedValuesAndAttributes
bool allowMixedValuesAndAttributes [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
anonymousTagNameIsNull
bool anonymousTagNameIsNull [@property getter]

Causes parseSdlTag to set the tag name to null instead of "content" for anonymous tags. This allows the application to differentiate betweeen "content" tags and anonymous tags.

anonymousTagNameIsNull
bool anonymousTagNameIsNull [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
preserveSdlText
bool preserveSdlText [@property getter]

Prevents parseSdlTag from modifying the given sdl text for things such as processing escaped strings

preserveSdlText
bool preserveSdlText [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

attributes
auto attributes;

The attributes of the tag

column
size_t column;
Undocumented in source.
depth
size_t depth;

The depth of the tag, all root tags are at depth 0.

hasOpenBrace
bool hasOpenBrace;

Indicates the tag has an open brace

line
size_t line;

The line number of the SDL parser after parsing this tag.

name
const(char)[] name;

The name of the tag

namespace
const(char)[] namespace;

The namespace of the tag

values
auto values;

The values of the tag

Meta